<template>
	<div class="mainCon">
		<div class="containercontent sampleGet" v-if = "reload">
			<div class="form">
				<el-form label-width="100px" :inline="false" class="demo-form-inline form" :model="sampleForm" :rules="sampleFormRules" ref="sampleForm">
					<el-form-item label="检测项目" v-if="!isZuJian">
						<el-col :span="22">
							<el-select v-model="sampleForm.itemValue" size="mini" @change="changeItem" filterable style="width:100%;"  clearable>
								<el-option v-for="item in itemsList" :key="item.item" :label="item.itemName" :value="item.item">
								</el-option>
							</el-select>
						</el-col>
					</el-form-item>
          <el-form-item label="能力参数" prop="detectability" v-if="!isZuJian">
						<el-col :span="22">
							<el-select v-model="sampleForm.detectability" filterable style="width:100%;" size="mini"
							 ref="selectAbility" value-key="detectability" @change="changeAbility" @focus="readDetectList('')">
								<el-option v-for="item in abilityOptions" :key="item.detectability" :label="item.detectabilityName1" :value="item">
								</el-option>
							</el-select>
						</el-col>
					</el-form-item>
					<el-form-item label="任务" v-if="isZuJian" class = "taskFormItem">
						<el-col :span="22">
							<el-select v-model="sampleForm.taskListValue" size="mini" filterable remote :remote-method="readAllTask" @change="readSample"
							 style="width:100%;" @focus="readAllTask(3)" clearable>
								<!--@change="readTaskSample(sampleQuery)"-->
								<el-option v-for="item in taskList" :key="item.id" :label="item.name" :value="item.id">
								</el-option>
							</el-select>
						</el-col>
					</el-form-item>
					<el-form-item label="任务" v-if="!isZuJian" class = "taskFormItem">
						<el-col :span="22">
							<el-select v-model="sampleForm.taskListValue" size="mini" filterable remote :remote-method="readAllTask" @focus="focusTask"
							 @change="readSample" style="width:100%;" clearable>
								<el-option v-for="item in taskList" :key="item.id" :label="item.name" :value="item.id">
								</el-option>
							</el-select>
						</el-col>
					</el-form-item>
					<el-form-item label="计划领取人员" prop="appointtovalue" >
						<el-col :span="22">
							<el-select v-model="sampleForm.appointtovalue" size="mini" style="width:100%;" @change="readSample">
								<el-option v-for="item in testOptions" :key="item.value" :label="item.label" :value="item.value">
								</el-option>
							</el-select>
						</el-col>
					</el-form-item>
					<div class="inlineblock searDiv el-form-item" v-if="!isZuJian">
						<div class="inlineblock basicRightDistanceA searchIcon" style="margin-left:25px;">
							<el-button size="mini" @click="readSample()">搜索</el-button>
						</div>
						<div class="inlineblock basicRightDistanceA searchIcon">
							<el-button size="mini" @click="emptySearch()">清空</el-button>
						</div>

					</div>

				</el-form>
			</div>
			<div class="separaterowTable" style="height:calc(100% - 55px)">
				<div class="unclaimSapmle">
					<div class="tableTittle">
						<div><span class="fontImpact">1</span><span>待领样品</span></div>
						<div style="float:right;width:100px;" v-if="!isZuJian">是否分包：
							<el-checkbox v-model="doSub" @change="changeSub"></el-checkbox>
						</div>
						<div style="float:right;width:100px;" v-if="isZuJian">是否分包：
							<el-checkbox v-model="testpanelForm.doSub" disabled class="disabledCheck"></el-checkbox>
						</div>
					</div>
					<el-table :data="tableDataHasChose" style="width: 100%" class="tableCon" @selection-change="handleSelectionChange" size="mini"
					 ref="multipleTable">
						<el-table-column type="selection" fixed width="38px">
						</el-table-column>
						<el-table-column label="序号" fixed width="50px">
							<template slot-scope="scope">
								{{scope.$index+1}}
							</template>
						</el-table-column>
						<el-table-column property="sampleCode" label="样品编号" fixed  min-width="120px" :show-overflow-tooltip="true">
							<!--<template slot-scope="scope">
								{{scope.row.doBlind ? scope.row.blindCode:scope.row.sampleCode}}
							</template>-->
						</el-table-column>
						<el-table-column label="样品名称"  min-width="120px" property="sampleName" show-overflow-tooltip>
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.sampleName}}
							</template>
						</el-table-column>
						<el-table-column label="任务名称"  min-width="120px" property="taskName" show-overflow-tooltip>
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.taskName}}
							</template>
						</el-table-column>
						<el-table-column property="qcTypeName" label="QC类型"  min-width="100px" v-if = "!doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.qcTypeName}}
							</template>
						</el-table-column>
						<el-table-column property="parentCode" label="父样编号"  min-width="120px" show-overflow-tooltip v-if = "!doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.parentCode}}
							</template>
						</el-table-column>
						<el-table-column property="subcontractorName" label="分包商" min-width="120px" show-overflow-tooltip v-if = "doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.subcontractorName}}
							</template>
						</el-table-column>
						<el-table-column property="detectabilityName" label="能力参数" min-width="120px" show-overflow-tooltip v-if = "doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.detectabilityName}}
							</template>
						</el-table-column>
						<el-table-column property="detectabilityName" label="能力参数" min-width="120px" show-overflow-tooltip v-if = "isZuJian && testpanelForm.doSub">
						</el-table-column>
					</el-table>
				</div>
				<div class="tablemiddle">
					<div :class = "{'peiButton':multipleSelection.length > 0}">
						<i class="el-icon-arrow-right" @click="changeReceivedSapmle"></i>
					</div>
					<div :class = "{'peiButton':multipleReceived.length > 0}">
						<i class="el-icon-arrow-left" @click="changeUnclaimSapmle"></i>
					</div>
				</div>
				<div class="receivedSapmle">
					<div class="tableTittle">
						<div><span class="fontImpact">2</span><span>已领样品</span></div>
						<!--<div class="inlineblock  searchIcon"  v-if="!isZuJian" style="">-->
						<el-button size="mini" style="color:#fff;float:right;margin-left:10px;" type="primary" @click="subReceived" v-if="!isZuJian && userOpernation.gain.display"
						 :disabled="!isRepeat">领取</el-button>
						<!--</div>-->
					</div>
					<el-table :data="receivedSapmle" ref="receivedSampled" style="width: 100%" class="tableCon" size="mini"
					 @selection-change="handleReceivedChange">
						<el-table-column type="selection" fixed width="38px">
						</el-table-column>


						<el-table-column property="beihao" label="序号" fixed width="50px">
							<template slot-scope="scope">
								{{scope.$index + 1}}
							</template>
						</el-table-column>
						<el-table-column property="sampleCode" label="样品编号" fixed  min-width="120px" :show-overflow-tooltip="true">
							<!--<template slot-scope="scope">
								{{scope.row.doBlind ? scope.row.blindCode:scope.row.sampleCode}}
							</template>-->
						</el-table-column>
						<el-table-column label="样品名称"  min-width="120px" property="sampleName" show-overflow-tooltip>
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.sampleName}}
							</template>
						</el-table-column>
						<el-table-column label="任务名称"  min-width="120px" property="taskName" show-overflow-tooltip>
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.taskName}}
							</template>
						</el-table-column>
						<el-table-column property="qcTypeName" label="QC类型" :formatter="qcFormatter" min-width="100px" v-if = "!doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.qcTypeName}}
							</template>
						</el-table-column>
						<el-table-column property="parentCode" label="父样编号"  min-width="120px" show-overflow-tooltip v-if = "!doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.parentCode}}
							</template>
						</el-table-column>
						<el-table-column property="subcontractorName" label="分包商" min-width="120px" show-overflow-tooltip v-if = "doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.subcontractorName}}
							</template>
						</el-table-column>
						<el-table-column property="detectabilityName" label="能力参数" min-width="120px" show-overflow-tooltip v-if = "doSub">
							<template slot-scope="scope">
								{{scope.row.doBlind ? '***':scope.row.detectabilityName}}
							</template>
						</el-table-column>
						<el-table-column property="detectabilityName" label="能力参数" min-width="120px" show-overflow-tooltip v-if = "isZuJian && testpanelForm.doSub">
						</el-table-column>


					</el-table>
				</div>
			</div>
		</div>
	</div>
</template>

<script>
	import $ from 'jquery'
	import { mapState } from 'vuex'
	// const addqc = () => import('./children/addQC.vue');

	export default {
		data() {
			let that = this;
			return {
				sampleForm: {  //能力参数和检测人表单
					detectability: {}, //能力参数绑定值
					appointtovalue: 0, //检测人绑定值
					taskListValue: '', //任务绑定值
          itemValue:"",
				},
				sampleFormRules: { //验证规则
					detectability: [{ required: true, message: '请选择能力参数', trigger: 'change' }],
				},
				abilityOptions: [], //能力参数选项
				taskList: [], //任务列表
				userData: [], //检测人数据
				tableDataHasChose: [], //待选样品表数据
				receivedSapmle: [], //已选样品数据
				multipleSelection: [], //勾选的待选样品
				multipleReceived: [], //勾选的已选样品
				testOptions: [  //检测筛选选项
					{
						value: 1,
						label: '我的'
					},
					{
						value: 0,
						label: '全部'
					}
				],
				isRepeat: true,
				doSub: false, //是否分包
				allSample:[], //选中能力参数下所有的数据
				allSample1:[],//当前搜索条件下所有的数据
				selectDetectability:null,
				isShow:false,
        selectedAblity:null,
        itemsList:[],
        itemValue:"",
        reload:true,



			}
		},
		components: {

		},
		mounted() {
			this.$store.dispatch('dogetDictionary') //接收vuestore里面数据字典数据
			this.userInfo = JSON.parse(sessionStorage.getItem('laboratoryAccountInfo'));
			// this.readDetectList('');
			// this.readAllTask('');
      this.getTestItems();
			this.readUser('');
			this.selectedAblity = JSON.parse(sessionStorage.getItem('selectedAblity'));
			console.log(this.selectedAblity)
			if(this.selectedAblity != null && this.selectedAblity !='' && this.selectedAblity != '{}'){
			 // 如果是从代办跳转并且有ids的话，进入页面调用能力参数的接口
        if(this.selectedAblity.hasOwnProperty('ids') && this.selectedAblity.ids.indexOf(";") != -1){
          var ablity = this.selectedAblity.ids.split(';')[1]
          this.readDetectList(ablity);
			  }
			}
		},
    destroyed(){
      sessionStorage.removeItem('selectedAblity')
    },
		computed: {
			...mapState(['typeQcSelect']),

		},
		props: ['isZuJian', 'detectability','testpanelForm','userOpernation'],
		methods: {
			// 过滤QC类型
			qcFormatter(row, column, cellValue, index) {
				return this.util.codeChangeName({ cellValue: cellValue, list: this.typeQcSelect.itemList })
			},
      getTestItems(){
        if(this.isZuJian){
          return;
        }
        this.$http({
        	method: 'post',
        	apiUrl: '/detection/getTestItems.htm',
        }).then(res => {
        	if (res.code == 0) {
        		this.itemsList = res.data
        	}
        })
      },
			// 清空搜索条件
			emptySearch() {
				this.sampleForm.taskListValue = "";
				this.sampleForm.appointtovalue = 0;
				// this.sampleForm.appointtovalue.detectability = {};
				this.readSample();
			},
      changeItem(){
        // this.sampleForm.detectability = {}
      },
			//   搜索能力参数
			readDetectList(ablity) {
				var params = {
					doSub: this.doSub,
          item:this.sampleForm.itemValue,
				}
				this.$http({
					method: 'post',
					apiUrl: '/detection/getTestDetect.htm',
					params: params,
					isJson: false
				}).then(res => {
					if (res.code == 0) {
						if(res.data.length == 0){
							this.abilityOptions = [];
							this.$notify({
								title:"警告！",
								message:res.description,
								type:"warning"
							})
							return;
						}else{
              if(this.doSub){
                res.data.forEach((item) =>{
                  item.detectabilityName1= item.detectabilityName
                })
              }else{
                res.data.forEach((item) =>{
                  item.detectabilityName1= "【" + item.version + "】"+ item.detectabilityName
                })
              }

							this.abilityOptions = res.data
              // 如果是从代办跳转 对比能力参数 并且赋值
              if(ablity != undefined && ablity != null && ablity != ""){
                res.data.forEach((item1) =>{
                  if(item1.detectability == ablity){
                    this.sampleForm.detectability = item1
                    this.changeAbility(item1);
                  }
                })
              }
						}

					}

				})
			},
			// 搜索栏搜索任务下拉框
			readAllTask(step) {
				console.log(this.selectDetectability)
				var detectability = '';
				if(this.selectDetectability != null){
					detectability = this.selectDetectability.detectability
				}
				if(this.isZuJian){
					detectability = null;
				}
				this.$http({
					method: 'post',
					apiUrl: '/detection/readAllTask.htm',
					params: {
						step: step,
						detectability:detectability,
						doSub:this.isZuJian == undefined ? this.doSub : this.testpanelForm.doSub,
					},
					isJson: false
				}).then(res => {
					if (res.code === 0) {
						this.taskList = res.data
					}

				})
			},
			// 搜索检测人
			readUser(item) {
				this.$http({
					method: 'post',
					apiUrl: '/resource/readEmployeeByLab.htm',
					params: { name: item },
					isJson: true,
				}).then(res => {
					if (res.code === 0) {
						this.userData = res.data;
					}

				})
			},
			// 保存只有能力参数得搜索条件，全部下得样品
			readallSample() {
				return new Promise((resolve, reject) => {
					this.$http({
						method: 'post',
						apiUrl: '/detection/getTestSample.htm',
						params: {
							detectability: this.isZuJian == undefined ? this.sampleForm.detectability.detectability :  (this.testpanelForm.doSub ? null:this.detectability),
							task: '',
							analyst: '',
							doSub:this.isZuJian == undefined ? this.doSub : this.testpanelForm.doSub,
						},
						isJson: false
					}).then(res => {
						if (res.code == 0) {
							resolve(res)
						}
					})
				})
			},
			// 待领取样品
			readSample() {
				var analyst = '';
				if (this.sampleForm.appointtovalue == '1') {
					analyst = this.userInfo.loginid
				} else {
					analyst = '';
				};
				// 不是组件并且不是分包的 必须先选中能力参数
				if(this.isZuJian == undefined ){
					if(!this.doSub){
						if(this.sampleForm.detectability.detectability == undefined){
							this.$message({
								type: 'info',
								message: '请先选中能力参数！'
							})
							return;
						}
					}
				}
				this.$http({
					method: 'post',
					apiUrl: '/detection/getTestSample.htm',
					params: {
						// 如果是组件里面用的 判断是不是分包，是分包则能力参数传null，不是分包传该批次的能力参数
						detectability: this.isZuJian == undefined ? this.sampleForm.detectability.detectability : (this.testpanelForm.doSub ? null:this.detectability),
						task: this.sampleForm.taskListValue,
						analyst: analyst,
						doSub:this.isZuJian == undefined ? this.doSub : this.testpanelForm.doSub,
					},
					isJson: false
				}).then(res => {
					if (res.code == 0) {
						this.allSample1 = res.data;
						//判断 --- 开始 ,判断查询出来的数据 是否已经被右边框选中，若选中的，则删除掉。
						this.tableDataHasChose = this.util.deleteArrSomeObj({ allArr: res.data, delArr: this.receivedSapmle, unique: 'id' });

						//判断 --- 结束
					}
				})
			},
			// 选中的待领样品
			handleSelectionChange(val) {
				this.multipleSelection = val;
			},
			// 把选中的选项加入已领样品类别，并删除加入的选项
			changeReceivedSapmle() {
				// debugger;
				if (this.multipleSelection != undefined && this.multipleSelection.length != 0) {
					//1.选中一条数据，并获取相同parent值得数据，一起加入到右边框中
					var aboutSub = [];
					console.log(this.multipleSelection)
					for (var i in this.multipleSelection) {
						// if (this.doSub ) { //如果勾中分包，并且勾中的样品没有分包商,则不加入
						// 	if (this.multipleSelection[i].doSubpackage) {
						// 		var chooseparent = this.multipleSelection[i].parent;
						// 		for (var j in this.tableDataHasChose) {
						// 			if (chooseparent == this.tableDataHasChose[j].parent) {
						// 				aboutSub.push(this.tableDataHasChose[j])
						// 			}
						// 		}
						// 	}
						// } else {//如果没有勾中分包，但是选中的样品中有分包商,则不加入，只加入没有分包商的
							// if (!this.multipleSelection[i].doSubpackage) {
								var chooseparent = this.multipleSelection[i].parent;
								var chooseTask = this.multipleSelection[i].task;

								for (var j in this.tableDataHasChose) {
									if (chooseparent == this.tableDataHasChose[j].parent && chooseTask == this.tableDataHasChose[j].task) {

										aboutSub.push(this.tableDataHasChose[j])
									}
								}
							// }
						// }
					}
					console.log(aboutSub)
					this.receivedSapmle = this.util.repeatData({ old: this.receivedSapmle, new: aboutSub, unique: 'id', sort:"order" })

					//2.删除左边框中已经选中的数据（包框相同parent的数据）
					this.tableDataHasChose = this.util.deleteArrSomeObj({ allArr: this.tableDataHasChose, delArr: aboutSub, unique: 'id' });
					// 3.重新给右边的样品排序 顺序为接口返回的数据 删除掉右边的,不分包的话要排序
					if(!this.doSub){
						var temp = [];
						for(var i in this.receivedSapmle){
							for(var j in this.allSample){
								if(this.receivedSapmle[i].id == this.allSample[j].id){
									temp.push(this.allSample[j])
								}
							}
						}
						this.receivedSapmle = temp.sort(this.compare('sort'));
					}


					this.$emit("showParentComp", this.receivedSapmle)

				}
			},
			compare(key){
				return function(value1,value2){
					var val1 = value1[key];
					var val2 = value2[key];
					return val1 - val2;
				}
			},
			// str.sort(compare('age'));
			changeSub(val) { //是否分包状态改变 右边已领样品表格清空
				this.sampleForm.appointtovalue = 0;
				this.sampleForm.detectability = {};
				this.selectDetectability = null;
				this.sampleForm.taskListValue = "";
				this.receivedSapmle = []; //右边的数据
				this.tableDataHasChose = []; //左边的数据
				this.allSample = [];
				this.allSample1 = [];
				this.taskList = [];


				if(val){
					this.readSample();
				}




				// var msg = null;
				// if (val) {
				// 	msg = "选择分包,将会清空已选中的样品"
				// } else {
				// 	msg = "取消分包,将会清空已选中的样品"
				// }
				// if (this.receivedSapmle.length > 0) {
				// 	this.$confirm(msg, '提示', {
				// 		confirmButtonText: '确定',
				// 		cancelButtonText: '取消',
				// 		type: 'warning'
				// 	}).then(() => {
				// 		this.receivedSapmle = []; //清空右边的数据
				// 		this.tableDataHasChose = this.allSample1; //左边的数据重新赋值为接口返回的数据的顺序

				// 	}).catch(() => {
				// 		this.doSub = !val
				// 		this.$message({
				// 			type: 'info',
				// 			message: '已取消'
				// 		});
				// 	});
				// }

			},
			handleReceivedChange(val) {
				this.multipleReceived = val;
			},
			// 把右边勾选的数据返回到左边
			changeUnclaimSapmle() {
				//1.获取勾选的数据，并且包括同parent的数据
				console.log(this.multipleReceived,this.receivedSapmle)
				for (var i in this.multipleReceived) {
					var chooseparent = this.multipleReceived[i].parent;
					var chooseTask = this.multipleReceived[i].task;
					for (var j in this.receivedSapmle) {
						if (chooseparent == this.receivedSapmle[j].parent && chooseTask == this.receivedSapmle[j].task) {
							this.multipleReceived.push(this.receivedSapmle[j])
						}
					}
				}
				var arrTemp = [];
				//2.判断任务是否改变，不改变则返回左边。
				for (var j in this.multipleReceived) {
					if (this.multipleReceived[j].task == this.sampleForm.taskListValue || this.sampleForm.taskListValue == '') { //任务没有改变
						arrTemp.push(this.multipleReceived[j]);	//返回到左边框中
					}
				}
				//左边框去重处理
				this.tableDataHasChose = this.util.repeatData({ old: this.tableDataHasChose, new: arrTemp, unique: 'id' })
				//3.删除右边框中选中的条目
				this.receivedSapmle = this.util.deleteArrSomeObj({ allArr: this.receivedSapmle, delArr: this.multipleReceived, unique: 'id' });
				//重新给左边的数据排序，接口返回的顺序 删除掉右边已选的样品
				this.tableDataHasChose = this.util.deleteArrSomeObj({ allArr: this.allSample1, delArr: this.receivedSapmle, unique: 'id' });
			},
			//切换能力参数时  已选样品情空
			changeAbility(val) {
				this.readallSample().then(res => {  //先获取只有能力参数下的样品，
					for(var i in res.data){
						this.$set(res.data[i],"sort",Number(i) + 1)
					}
					this.allSample = res.data;
					this.selectDetectability = val
					if(this.isZuJian == undefined){
						this.readSample();
					}
					if(!this.doSub){
						this.receivedSapmle = [];
					}



				})

			},

			focusTask() {
				if (!this.doSub && (this.sampleForm.detectability.detectability == '' || this.sampleForm.detectability.detectability == undefined)) {
					this.$message({
						type: 'info',
						message: '请先选中能力参数！'
					})
					return;
				} else {
					this.readAllTask(3);
				}
			},
			// 清空选中  已选样品数组置空
			toggleSelection(rows) {
				if (rows) {
					rows.forEach(row => {
						this.$refs.multipleTable.toggleSelection(row);
					});
				} else {
					this.$refs.multipleTable.clearSelection();
				}
				this.sampleForm.taskListValue = "";
				this.sampleForm.appointtovalue = 1;
				this.receivedSapmle = [];

			},
			// 已领样品列表中删除
			deleteSample(row, index) {
				this.$confirm('是否删除', '提示', {
					confirmButtonText: '确定',
					cancelButtonText: '取消',
					type: 'warning'
				}).then(() => {
					this.receivedSapmle.splice(index, 1);

					// 循环已领样品，如果有与当前要删除条的parent一样的  一起删除
					for (var i = 0; i < this.receivedSapmle.length; i++) {
						if (row.parent == this.receivedSapmle[i].parent  && row.task == this.receivedSapmle[i].task) {
							this.receivedSapmle.splice(i, 1);
						}
					}
				}).catch(() => {
					this.$message({
						type: 'info',
						message: '已取消删除'
					});
				});



			},
			// 提交选中的样品和能力参数检测人
			subReceived(sampleForm) {
				this.$refs.sampleForm.validate((valid) => { //表单验证
					if (valid) {

							if(this.doSub){
								var data = {
									detectability: "---",
									method: "---",
									detectabilityName: "---",
									sampleBeans: this.receivedSapmle,
									doSub:this.doSub,
								}
								this.addTestBatch(data)
							}else{
								var data = {
									detectability: this.sampleForm.detectability.detectability,
									method: this.sampleForm.detectability.method,
									detectabilityName: this.sampleForm.detectability.detectabilityName,
									sampleBeans: this.receivedSapmle,
									doSub:this.doSub,
								}
								// 验证样品是否领取完全 分包不用验证
								this.verifyBatchQc().then(() =>{
									this.addTestBatch(data)
								})
							}



					} else {
						return false;
					}
				})
			},
			addTestBatch(data){
				this.isRepeat = false;
				this.$http({
					method: 'post',
					apiUrl: '/detection/addTestBatch.htm',
					params: data,
					isJson: true,
          isLoading:true
				}).then(res => {
					this.isRepeat = true;
					if (res.code === 0) {
						this.$notify({
							type: 'success',
							message: '领取成功!',
							title:"成功",
						});
            this.closeMessage(data)
						this.receivedSapmle = [];
						// this.readSample();
            this.initData()

					}

				})
			},
      initData(){
        this.$set(this,'tableDataHasChose',[]);
        this.sampleForm = {  //能力参数和检测人表单
        	detectability: {}, //能力参数绑定值
        	appointtovalue: 0, //检测人绑定值
        	taskListValue: '', //任务绑定值
          itemValue:"",
        }
        this.abilityOptions = [];
        this.doSub = false;
        this.reload = false;
        this.$nextTick(() =>{
          this.reload = true;
        })
      },
      closeMessage(data){
        this.$http({
          method: 'post',
          apiUrl: '/detection/closeMessages.htm',
          params: data,
          isJson: true,
        }).then(res => {
          if (res.code === 0) {

          }
        })
      },
			// 验证是否有子样没有登记或者接受
			verifyBatchQc(){
				return new Promise((resolve, reject) => {
					this.$http({
						method: 'post',
						apiUrl: '/detection/verifyBatchQc.htm',
						params: this.receivedSapmle,
						isJson: true,
					}).then(res => {
						if (res.code === 0) {
							resolve(res)
						}

					})
				})

			},
		},
	}

</script>

<!-- Add "scoped" attribute to limit CSS to this component only -->
<style scoped>
	.searchitem {
		width: calc(100%/3);
		padding: 0;
		margin-right: 5px;
	}

	.searchitem .informationItem {
		width: calc(100% - 106px);
		float: none;
		margin-left: 8px;
	}

	.sampleGet .form {
		height: 55px;
	}

	.sampleGet .form .el-form-item {
		width: calc(100%/5);
		float: left;
		margin-bottom: 12px;
	}

	.el-form-item.searDiv {
		height: 40px;
		line-height: 40px;
	}
	/*.taskItem.el-form-item {
		clear: both;
	}*/

	.separaterowTable .unclaimSapmle,
	.separaterowTable .receivedSapmle {
		width: 45%;
		height: 100%;
	}

	.separaterowTable .unclaimSapmle {
		float: left;
	}

	.separaterowTable .receivedSapmle {
		float: right;
	}


	.tablemiddle {
		position: absolute;
		left: calc(45% - 5px);
		top: 45%;
		font-size: 30px;
		width: 10%;
		text-align: center;
	}

	.tablemiddle i {
		cursor: pointer;
		font-size:16px;
	}

	.el-icon-arrow-right,
	.el-icon-arrow-left {
		border: 1px solid #dcdfe6;
        background-color: #f5f7fa;
		display: inline-block;
		width: 35px;
		height: 35px;
		line-height: 35px;
		border-radius: 50%;
	}

	.el-icon-arrow-right::before,
	.el-icon-arrow-left::before {
		color: #999;
	}
</style>
<style>

	.disabledCheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner{
		    background-color: #409EFF;
    		border-color: #409EFF;
	}
	.disabledCheck .el-checkbox__input.is-disabled.is-checked .el-checkbox__inner::after{
		border-color:#fff
	}
	.taskFormItem .el-form-item__label{
		width:60px !important;
	}
	.taskFormItem  .el-form-item__content{
		margin-left:60px !important;
	}
</style>
